package cn.iocoder.yudao.module.nmkj.dal.mysql.teamintroduce;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.nmkj.dal.dataobject.teamintroduce.TeamIntroduceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.nmkj.controller.admin.teamintroduce.vo.*;

/**
 * 团队介绍 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TeamIntroduceMapper extends BaseMapperX<TeamIntroduceDO> {

    default PageResult<TeamIntroduceDO> selectPage(TeamIntroducePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeamIntroduceDO>()
                .eqIfPresent(TeamIntroduceDO::getAvatar, reqVO.getAvatar())
                .likeIfPresent(TeamIntroduceDO::getName, reqVO.getName())
                .eqIfPresent(TeamIntroduceDO::getIdentity, reqVO.getIdentity())
                .eqIfPresent(TeamIntroduceDO::getIdentityDescribe, reqVO.getIdentityDescribe())
                .eqIfPresent(TeamIntroduceDO::getSort, reqVO.getSort())
                .eqIfPresent(TeamIntroduceDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(TeamIntroduceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TeamIntroduceDO::getStatus)
                .orderByDesc(TeamIntroduceDO::getSort));
    }

    default List<TeamIntroduceDO> selectList(TeamIntroducePageReqVO reqVO) {
        reqVO.setStatus(1); //固定设置用户端只允许查询启用状态
        return selectList(new LambdaQueryWrapperX<TeamIntroduceDO>()
                .eqIfPresent(TeamIntroduceDO::getAvatar, reqVO.getAvatar())
                .likeIfPresent(TeamIntroduceDO::getName, reqVO.getName())
                .eqIfPresent(TeamIntroduceDO::getIdentity, reqVO.getIdentity())
                .eqIfPresent(TeamIntroduceDO::getIdentityDescribe, reqVO.getIdentityDescribe())
                .eqIfPresent(TeamIntroduceDO::getSort, reqVO.getSort())
                .eqIfPresent(TeamIntroduceDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(TeamIntroduceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TeamIntroduceDO::getStatus)
                .orderByDesc(TeamIntroduceDO::getSort));
    }

}